Optimal. Leaf size=136 \[ \frac {1}{8} \left (3 a^2 A+4 A b^2+8 a b B\right ) x+\frac {\left (2 a A b+a^2 B+b^2 B\right ) \sin (c+d x)}{d}+\frac {\left (3 a^2 A+4 A b^2+8 a b B\right ) \cos (c+d x) \sin (c+d x)}{8 d}+\frac {a^2 A \cos ^3(c+d x) \sin (c+d x)}{4 d}-\frac {a (2 A b+a B) \sin ^3(c+d x)}{3 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.18, antiderivative size = 136, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 6, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.194, Rules used = {4109, 4132,
2715, 8, 4129, 3092} \begin {gather*} \frac {\left (a^2 B+2 a A b+b^2 B\right ) \sin (c+d x)}{d}+\frac {\left (3 a^2 A+8 a b B+4 A b^2\right ) \sin (c+d x) \cos (c+d x)}{8 d}+\frac {1}{8} x \left (3 a^2 A+8 a b B+4 A b^2\right )+\frac {a^2 A \sin (c+d x) \cos ^3(c+d x)}{4 d}-\frac {a (a B+2 A b) \sin ^3(c+d x)}{3 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 2715
Rule 3092
Rule 4109
Rule 4129
Rule 4132
Rubi steps
\begin {align*} \int \cos ^4(c+d x) (a+b \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx &=\frac {a^2 A \cos ^3(c+d x) \sin (c+d x)}{4 d}-\frac {1}{4} \int \cos ^3(c+d x) \left (-4 a (2 A b+a B)+\left (A \left (-3 a^2-4 b^2\right )-8 a b B\right ) \sec (c+d x)-4 b^2 B \sec ^2(c+d x)\right ) \, dx\\ &=\frac {a^2 A \cos ^3(c+d x) \sin (c+d x)}{4 d}-\frac {1}{4} \int \cos ^3(c+d x) \left (-4 a (2 A b+a B)-4 b^2 B \sec ^2(c+d x)\right ) \, dx-\frac {1}{4} \left (-3 a^2 A-4 A b^2-8 a b B\right ) \int \cos ^2(c+d x) \, dx\\ &=\frac {\left (3 a^2 A+4 A b^2+8 a b B\right ) \cos (c+d x) \sin (c+d x)}{8 d}+\frac {a^2 A \cos ^3(c+d x) \sin (c+d x)}{4 d}-\frac {1}{4} \int \cos (c+d x) \left (-4 b^2 B-4 a (2 A b+a B) \cos ^2(c+d x)\right ) \, dx-\frac {1}{8} \left (-3 a^2 A-4 A b^2-8 a b B\right ) \int 1 \, dx\\ &=\frac {1}{8} \left (3 a^2 A+4 A b^2+8 a b B\right ) x+\frac {\left (3 a^2 A+4 A b^2+8 a b B\right ) \cos (c+d x) \sin (c+d x)}{8 d}+\frac {a^2 A \cos ^3(c+d x) \sin (c+d x)}{4 d}+\frac {\text {Subst}\left (\int \left (-4 b^2 B-4 a (2 A b+a B)+4 a (2 A b+a B) x^2\right ) \, dx,x,-\sin (c+d x)\right )}{4 d}\\ &=\frac {1}{8} \left (3 a^2 A+4 A b^2+8 a b B\right ) x+\frac {\left (2 a A b+a^2 B+b^2 B\right ) \sin (c+d x)}{d}+\frac {\left (3 a^2 A+4 A b^2+8 a b B\right ) \cos (c+d x) \sin (c+d x)}{8 d}+\frac {a^2 A \cos ^3(c+d x) \sin (c+d x)}{4 d}-\frac {a (2 A b+a B) \sin ^3(c+d x)}{3 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.47, size = 118, normalized size = 0.87 \begin {gather*} \frac {12 \left (3 a^2 A+4 A b^2+8 a b B\right ) (c+d x)+24 \left (6 a A b+3 a^2 B+4 b^2 B\right ) \sin (c+d x)+24 \left (a^2 A+A b^2+2 a b B\right ) \sin (2 (c+d x))+8 a (2 A b+a B) \sin (3 (c+d x))+3 a^2 A \sin (4 (c+d x))}{96 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.44, size = 152, normalized size = 1.12
method | result | size |
derivativedivides | \(\frac {a^{2} A \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+\frac {a^{2} B \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+\frac {2 A b a \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+2 B a b \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+A \,b^{2} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+b^{2} B \sin \left (d x +c \right )}{d}\) | \(152\) |
default | \(\frac {a^{2} A \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+\frac {a^{2} B \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+\frac {2 A b a \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+2 B a b \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+A \,b^{2} \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+b^{2} B \sin \left (d x +c \right )}{d}\) | \(152\) |
risch | \(\frac {3 a^{2} A x}{8}+\frac {x A \,b^{2}}{2}+x B a b +\frac {3 \sin \left (d x +c \right ) A b a}{2 d}+\frac {3 \sin \left (d x +c \right ) a^{2} B}{4 d}+\frac {\sin \left (d x +c \right ) b^{2} B}{d}+\frac {a^{2} A \sin \left (4 d x +4 c \right )}{32 d}+\frac {\sin \left (3 d x +3 c \right ) A b a}{6 d}+\frac {\sin \left (3 d x +3 c \right ) a^{2} B}{12 d}+\frac {a^{2} A \sin \left (2 d x +2 c \right )}{4 d}+\frac {\sin \left (2 d x +2 c \right ) A \,b^{2}}{4 d}+\frac {\sin \left (2 d x +2 c \right ) B a b}{2 d}\) | \(170\) |
norman | \(\frac {\left (\frac {3}{8} a^{2} A +\frac {1}{2} A \,b^{2}+B a b \right ) x +\left (-\frac {3}{2} a^{2} A -2 A \,b^{2}-4 B a b \right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (-\frac {3}{8} a^{2} A -\frac {1}{2} A \,b^{2}-B a b \right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (-\frac {3}{8} a^{2} A -\frac {1}{2} A \,b^{2}-B a b \right ) x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {3}{4} a^{2} A +A \,b^{2}+2 B a b \right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {3}{4} a^{2} A +A \,b^{2}+2 B a b \right ) x \left (\tan ^{10}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\frac {3}{8} a^{2} A +\frac {1}{2} A \,b^{2}+B a b \right ) x \left (\tan ^{12}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {\left (5 a^{2} A -16 A b a +4 A \,b^{2}-8 a^{2} B +8 B a b -8 b^{2} B \right ) \left (\tan ^{11}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}+\frac {\left (5 a^{2} A +16 A b a +4 A \,b^{2}+8 a^{2} B +8 B a b +8 b^{2} B \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 d}+\frac {\left (21 a^{2} A -16 A b a -12 A \,b^{2}-8 a^{2} B -24 B a b -24 b^{2} B \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d}-\frac {\left (21 a^{2} A +16 A b a -12 A \,b^{2}+8 a^{2} B -24 B a b +24 b^{2} B \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d}+\frac {\left (39 a^{2} A -16 A b a +12 A \,b^{2}-8 a^{2} B +24 B a b +24 b^{2} B \right ) \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}-\frac {\left (39 a^{2} A +16 A b a +12 A \,b^{2}+8 a^{2} B +24 B a b -24 b^{2} B \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{4} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}\) | \(539\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.29, size = 142, normalized size = 1.04 \begin {gather*} \frac {3 \, {\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} A a^{2} - 32 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} B a^{2} - 64 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} A a b + 48 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} B a b + 24 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} A b^{2} + 96 \, B b^{2} \sin \left (d x + c\right )}{96 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 4.29, size = 114, normalized size = 0.84 \begin {gather*} \frac {3 \, {\left (3 \, A a^{2} + 8 \, B a b + 4 \, A b^{2}\right )} d x + {\left (6 \, A a^{2} \cos \left (d x + c\right )^{3} + 16 \, B a^{2} + 32 \, A a b + 24 \, B b^{2} + 8 \, {\left (B a^{2} + 2 \, A a b\right )} \cos \left (d x + c\right )^{2} + 3 \, {\left (3 \, A a^{2} + 8 \, B a b + 4 \, A b^{2}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{24 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 437 vs.
\(2 (128) = 256\).
time = 0.48, size = 437, normalized size = 3.21 \begin {gather*} \frac {3 \, {\left (3 \, A a^{2} + 8 \, B a b + 4 \, A b^{2}\right )} {\left (d x + c\right )} - \frac {2 \, {\left (15 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 24 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 48 \, A a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 24 \, B a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} + 12 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 24 \, B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{7} - 9 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 40 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 80 \, A a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 24 \, B a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 12 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 72 \, B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 9 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 40 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 80 \, A a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 24 \, B a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 12 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 72 \, B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 15 \, A a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 24 \, B a^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 48 \, A a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 24 \, B a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 12 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 24 \, B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{4}}}{24 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 2.18, size = 169, normalized size = 1.24 \begin {gather*} \frac {3\,A\,a^2\,x}{8}+\frac {A\,b^2\,x}{2}+\frac {3\,B\,a^2\,\sin \left (c+d\,x\right )}{4\,d}+\frac {B\,b^2\,\sin \left (c+d\,x\right )}{d}+B\,a\,b\,x+\frac {A\,a^2\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {A\,a^2\,\sin \left (4\,c+4\,d\,x\right )}{32\,d}+\frac {A\,b^2\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {B\,a^2\,\sin \left (3\,c+3\,d\,x\right )}{12\,d}+\frac {3\,A\,a\,b\,\sin \left (c+d\,x\right )}{2\,d}+\frac {A\,a\,b\,\sin \left (3\,c+3\,d\,x\right )}{6\,d}+\frac {B\,a\,b\,\sin \left (2\,c+2\,d\,x\right )}{2\,d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________